<!-- STATE -->
<div class="tabbertab" title="State">

<?php
/*	include_once("genser.php");
	$gs = new genser($settings["main"]["stbd_host"], "2244");

	$query = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><packet><cmd>task_list</cmd></packet>\r\n";
	$packet = simplexml_load_string( $gs->ask($query) );
	switch($packet->cmd) {
		case "task_list":
			echo "<table>";
			foreach($packet->task_list->children() as $child) {
				//echo "timestamp = ". $child->timestamp ."<br>\n";

				echo "<tr>";
				foreach($child->children() as $attr) {
					//echo $attr->getName() .": ". $attr ."<br>\n";
					echo "<td>$attr";
				}
			}
			echo "</table>";
			break;
	}
*/
	$query = "SELECT * FROM n_adc ORDER BY id DESC LIMIT 1";
	$result = mysql_query($query);
	$num_rows = mysql_num_rows($result);
	if($num_rows) {
		$row = mysql_fetch_array($result);

		$state = $row["state"];
	}
	else {
		$state = 3;
	}
?>
<table cellspacing='0' border='1'>
<tr>
<td valign='top' width='400'>
<font size='4'>Current State</font>
<?php include "secState". $state .".php"; ?>
<td valign='top' width='400'>
<font size='4'>Next State</font>
<?php include "secState". ($state + 1) % 4 .".php"; ?>
<table width='100%'><tr><td align='right'>
	<?php echo ($state + 1) % 4; ?>
	<input type='button' value='advance' onclick='javascript:process("advance", "<?php echo ($state + 1) % 4; ?>")'/></table>
</table>

</div>	<!-- end tabber tab -->
